package org.atlantis.ymer.server.transport;

import org.atlantis.ymer.Transport;
import org.atlantis.ymer.common.HttpResponseUtils;
import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.util.CharsetUtil;

// TODO remove it before release.
public class TestTransport implements Transport {

	@Override
	public void handle(ChannelHandlerContext ctx, Object data) {
		HttpRequest request = (HttpRequest) data;
		System.out.println(request.getUri());
		System.out.println(request.getContent().toString(CharsetUtil.UTF_8));
		ctx.getChannel().write(HttpResponseUtils.createCrossDomainHeaderResponse()).addListener(ChannelFutureListener.CLOSE);
	}
}
